import java.io.*;
import java.sql.*;

import java.util.Iterator;
import java.util.Vector;

import oracle.jdbc.driver.OracleDriver;

public class ConsultaDatos {


  Vector enviaNombre;
  Vector enviaTipo;

void ConsultarDatos(Vector tn,Vector tt){

      try{
        ConexionBD BD_con = new ConexionBD();
        Connection OJDBC_con = BD_con.DBConect();
        System.out.println("CONNECTED TO   ---> ");

        // Use the Connection to create a Statement object
        Statement STMT_comando = OJDBC_con.createStatement ();

        // Execute query using Statement, receive the ResultSet
        String STR_query ="SELECT carnet,nombre FROM estudiante";
        ResultSet RS_datos = STMT_comando.executeQuery(STR_query);
        System.out.println("EXECUTED QUERY ---> " + STR_query);

        // Print the results, row by row
        System.out.println("\nPROCESSING RESULTS:\n");
        while (RS_datos.next()) {
          tn.addElement(RS_datos.getString("carnet").trim());
          tt.addElement(RS_datos.getString("nombre").trim());
        }
        RS_datos.close();
        STMT_comando.close();
        OJDBC_con.close();

      } catch (SQLException e) {
        e.printStackTrace();
    }
   }

void LlenarDatos_ComboBox(Vector cod,Vector nombre){
        ConexionBD BD_con = new ConexionBD();
        try{
        Connection OJDBC_con = BD_con.DBConect();
        System.out.println("CONNECTED TO   ---> ");

        // Use the Connection to create a Statement object
        Statement STMT_comando = OJDBC_con.createStatement ();

        // Execute query using Statement, receive the ResultSet
        String STR_query ="SELECT cod_cliente,nombre FROM cliente";
        ResultSet RS_datos = STMT_comando.executeQuery(STR_query);
        System.out.println("EXECUTED QUERY ---> " + STR_query);

        // Print the results, row by row
        System.out.println("\nPROCESSING RESULTS:\n");
        while (RS_datos.next()) {
          cod.addElement(RS_datos.getString("cod_cliente").trim());
          nombre.addElement(RS_datos.getString("nombre").trim());
        }
        RS_datos.close();
        STMT_comando.close();
        OJDBC_con.close();

      }catch (SQLException e) {
        e.printStackTrace();
      }
    }
}





